<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计算器</title>
</head>
<body>
    <input type="text" id="inputNumber1" placeholder="请输入第一个数字">
    <select id="operator">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input type="text" id="inputNumber2" placeholder="请输入第二个数字">
    <button onclick="calculate()">计算</button>
    <p id="output"></p>

    <script>
        function calculate() {
            const inputNumber1 = parseFloat(document.getElementById('inputNumber1').value);
            const inputNumber2 = parseFloat(document.getElementById('inputNumber2').value);
            const operator = document.getElementById('operator').value;
            let output;

            switch (operator) {
                case '+':
                    output = inputNumber1 + inputNumber2;
                    break;
                case '-':
                    output = inputNumber1 - inputNumber2;
                    break;
                case '*':
                    output = inputNumber1 * inputNumber2;
                    break;
                case '/':
                    output = inputNumber1 / inputNumber2;
                    break;
                default:
                    output = '无效的操作符';
            }

            document.getElementById('output').innerText = '结果：' + output;
        }
    </script>
</body>
</html>